package example.guice.web.servlets

import grizzled.slf4j.Logging
import javax.inject.Inject
import javax.inject.Provider
import javax.servlet.http.HttpServlet
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

class BaseHttpServlet @Inject() (requestPojo: Provider[RequestPojo], sessionPojo: Provider[SessionPojo]) extends HttpServlet with Logging {

  override protected def doGet(req: HttpServletRequest, resp: HttpServletResponse) {
    if ("".equals(req.getParameter("logout"))) {
      req.getSession(true).invalidate();
    }
    resp.getWriter().write(s"Hello World: ${sessionPojo.get.random} ${requestPojo.get.random}");
  }

}